/**
 * This file is part of the dspace-poltman project http://www.poltman.com.
 *
 * This is free software; you can redistribute it and/or modify it under
 * the terms of DuraSpace DSpace license detailed in the LICENSE and NOTICE 
 * files at the root of the source tree and available online at
 * http://www.dspace.org/license/
 * 
 */
package com.poltman.dscentral.epeople;

import java.util.ArrayList;
import java.util.List;

import org.zkoss.zkplus.spring.SpringUtil;
import org.zkoss.zul.ListModelList;

import com.poltman.dscentral.db.service.pm.MainMenuGroupsService;

/**
 * 
 * @author Zbigniew Ciok; z.ciok@poltman.com
 * @version $Revision: 1548 $
 *
 */
public class AddEPeopleMenuGroupsVM {
	
	public class MenuItemsModel {
		private String name;

		public String getName() {
			return name;
		}

		public void setName(String name) {
			this.name = name;
		}
	}	
	
	
	List<MenuItemsModel> items;
	public List<MenuItemsModel> getItems() {
		return items;
	}
	public void setItems(List<MenuItemsModel> items) {
		this.items = items;
	}
	

	ListModelList<MenuItemsModel> sourceShortcuts = null;
	/**
	 * Shortcuts model
	 * @return
	 * @throws Exception
	 */
	public ListModelList<MenuItemsModel> getSourceShortcuts() throws Exception {
		
		MainMenuGroupsService mainMenuGroupsService = (MainMenuGroupsService) SpringUtil.getBean("mainMenuGroupsService");
		List<String> shortCuts = mainMenuGroupsService.findAllShortcuts();	
		
		items = new ArrayList<MenuItemsModel>();
		for (int i = 0; i < shortCuts.size(); i++) {
			String sItem = shortCuts.get(i);
			MenuItemsModel item = new MenuItemsModel();
			item.setName(sItem);
			items.add(item);
		}		
		this.sourceShortcuts = new ListModelList<MenuItemsModel>(items);		
		return this.sourceShortcuts;		
	}
}
